<template>
  <div class="masonry border-card">
    <div class="item" v-for="(item, index) in props.list" :key="index">
      <div class="imgWrapper">
        <img :src="item.img" alt="" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { NImage, NEllipsis } from "naive-ui";
const props = defineProps({
  list: {
    type: Array,
    default() {
      return [];
    },
  },
});
</script>

<style lang="scss" scoped>
.masonry {
  display: flex;
  flex-wrap: wrap;
  transition: all 1s ease;
  margin-top: 10px;
  &::after {
    content: "";
    flex-grow: 999999999;
  }
  .item {
    overflow: hidden;
    break-inside: avoid;
    margin-bottom: 3px;
    flex-grow: 1;
    margin: 3px;
    img {
      object-fit: cover;
      transition: all ease 0.3s;
      width: 100%;
      height: 198px;
      vertical-align: middle;
    }
    .title {
      display: block;
      margin-left: 5px;
      font-size: 12px;
    }
  }
}
@media screen and (max-width: 1000px) {
  .masonry {
    column-count: 3;
  }
}
@media screen and (max-width: 600px) {
  .masonry {
    column-count: 2;
  }
}
</style>
